<?php
// $Id$

/**
 * Controller_Help 控制器
 */
class Controller_Help extends Controller_Abstract
{

	function actionIndex() {
		
		$this->_view['newbie'] = Posts::find(" category_id = 13 AND `status` = 'publish' ")->Order(' ID DESC')->getAll();
		$this->_view['advanced'] = Posts::find( " category_id = 14  AND `status` = 'publish' ")->Order(' ID DESC')->getAll();
		
		if ( empty($this->_context->nid) ){
			
			if ( count($this->_view['newbie']) > 0 )
				$this->_view['post'] = $this->_view['newbie'][0];
			$this->_view['page_name'] = '';
		}else {
			$this->_view['post'] = Posts::find(' ID = ?', $this->_context->nid)->getOne();
			$this->_view['page_name'] = $this->_view['post']['title'];

		}
		
		if ( !empty($this->_view['post']) )
			$this->_view['author'] = Authors::find(' ID =?', $this->_view['post']->author_id )->getOne();
		
		$this->_viewname = 'help_view';
	}//END action Index
	
	function actionFaq(){
				
		$this->_view['newbie'] = Posts::find(" category_id = 13 AND `status` = 'publish' ")->Order(' ID DESC')->getAll();
		$this->_view['advanced'] = Posts::find( " category_id = 14  AND `status` = 'publish' ")->Order(' ID DESC')->getAll();
		$this->_view['faq'] = Posts::find(" category_id = 15  AND `status` = 'publish' ")->Order(' ID DESC')->getAll();
		$this->_view['page_name'] = "常见问题解答";
		
		$this->_viewname = 'faq_view';
	}//END action Faq
}


